/* 
类类型: 实现接口
1. 一个类可以实现多个接口
2. 一个接口可以继承多个接口

*/
(function () {
  interface Alarm {
    alert(): string;
  }

  interface Light {
    lightOn (): void; 
    lightoff (): void; 
  }

  class Car implements Alarm, Light {
    alert(): string {
      console.log('alert()')
      return '警报....'
    }

    lightOn (): void {
      console.log('lightOn()')
    }

    lightoff (): void {
      console.log('lightoff()')
    }
  }

  const c: Car = new Car()
  c.alert()
  c.lightOn()
  c.lightoff()

  interface LightableAlarm extends Alarm, Light {

  }

  class Car2 implements LightableAlarm {
    alert(): string {
      console.log('alert()2')
      return '警报....'
    }

    lightOn (): void {
      console.log('lightOn()2')
    }

    lightoff (): void {
      console.log('lightoff()2')
    }
  }
 
})()